<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<title>Compare Target</title>

<style type="text/css">
/* <![CDATA[ */

table, td
{
    border-color: #666;
    border-style: solid;
}
table, th
{
    border-color: #666;
    border-style: solid;
}

table
{
    border-width: 0 0 1px 1px;
    border-spacing: 0;
    border-collapse: collapse;
}
 
td
{
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
}
th
{
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
}

#table2{
	position:absolute;
	top:190px;
	left:900px;
}

/* ]]> */
</style>

<link type="text/css" href="/css/start/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.21.custom.min.js"></script>

</head>
<body style="font-family:Arial, Helvetica, sans-serif">
<script>

</script>
<h2>Compare Shop Target ( <?php echo $this->cycle;?> )</h2>    
<h2>Shop Target : <?php echo $this->dateStart ?> to <?php echo $this->dateEnd ?><br /></h2>
<br />

<a href="<?php echo WEB_IP?>/shops/config-formula" target="_blank">Manager Commission Formula</a> | <a href="<?php echo WEB_IP?>/salesmonitor/last-eight-weeks-sales" target="_blank">Last 8 Week Sales</a><br /><br />
 

<?php
$arrWeek = $this->arrWeek;
$weeks = count($arrWeek);
$stffInfo = new Model_DbTable_Roster_Stafflogindetail();
?>
<span style="background-color:#C90; width:20px; display:inline-block">&nbsp;&nbsp;&nbsp;</span> T1
<span style="background-color:#0F0; width:20px; display:inline-block">&nbsp;&nbsp;&nbsp;</span> T2
<span style="background-color:#3CF; width:20px; display:inline-block">&nbsp;&nbsp;&nbsp;</span> T3
<form method = "post" action = "" enctype="multipart/form-data">
 <table width="800" border="0" cellspacing="1" cellpadding="5">
  <tr>
    <th scope="col">Shop</th>
    <th scope="col">Sales</th>
    <th scope="col">Target1</th>
    <th scope="col">Target2</th>
    <th scope="col">Target3</th>
    <th scope="col">Hit Target</th>
    <th scope="col">Bonus<img src="/css/edit.gif"></img></th>
  </tr>
  <?php foreach($this->targetList as $k => $v){?>
  		<tr>
  			<td><?php echo $k?><input type = "hidden" name = "shop[<?php echo $k?>]" id = "shop[<?php echo $k?>]" value = "<?php echo $k?>"></input></td>
  			<td><?php echo $v['total_sale']?></td>
  			<td><?php echo $v['target1']?></td>
  			<td><?php echo $v['target2']?></td>
  			<td><?php echo $v['target3']?></td>
  			<td><?php if($v['total_sale']>= $v['target3']){
  						echo "<span style=\"background-color:#3CF\">T3</span>";?> 					  
				<?php  }elseif($v['total_sale']>= $v['target2']){
					   	echo "<span style=\"background-color:#0F0\">T2</span>";?>
				<?php  }elseif($v['total_sale']>= $v['target1']){
					   	echo "<span style=\"background-color:#C90\">T1</span>";?>
				<?php  }else{
					   	echo "None";?>
				<?php  }?></td>
				
  			<td><?php if(isset($v['final_bonus'])){?>
  				<?php if($v['total_sale']>= $v['target3']){?>
  					 $<input type = "text" name = "final_bonus[<?php echo $k?>]" id = "final_bonus[<?php echo $k?>]" value = "<?php echo $v['final_bonus'];?>"></input>
  					 <input type = "hidden" name = "bonus1[<?php echo $k?>]" id = "bonus1[<?php echo $k?>]" value = "<?php echo $v['htarget1'];?>"></input>
  					 <input type = "hidden" name = "bonus2[<?php echo $k?>]" id = "bonus2[<?php echo $k?>]" value = "<?php echo $v['htarget2'];?>"></input>
  					 <input type = "hidden" name = "bonus3[<?php echo $k?>]" id = "bonus3[<?php echo $k?>]" value = "<?php echo $v['htarget3'];?>"></input>
  					 				  
				<?php }elseif($v['total_sale']>= $v['target2']){?>
					 $<input type = "text" name = "final_bonus[<?php echo $k?>]" id = "final_bonus[<?php echo $k?>]" value = "<?php echo $v['final_bonus'];?>"></input>
					 <input type = "hidden" name = "bonus1[<?php echo $k?>]" id = "bonus1[<?php echo $k?>]" value = "<?php echo $v['htarget1'];?>"></input>
  					 <input type = "hidden" name = "bonus2[<?php echo $k?>]" id = "bonus2[<?php echo $k?>]" value = "<?php echo $v['htarget2'];?>"></input>
  					 <input type = "hidden" name = "bonus3[<?php echo $k?>]" id = "bonus3[<?php echo $k?>]" value = "0"></input> 
				<?php }elseif($v['total_sale']>= $v['target1']){?> 
					 $<input type = "text" name = "final_bonus[<?php echo $k?>]" id = "final_bonus[<?php echo $k?>]" value = "<?php echo $v['final_bonus'];?>"></input>  	   
					 <input type = "hidden" name = "bonus1[<?php echo $k?>]" id = "bonus1[<?php echo $k?>]" value = "<?php echo $v['htarget1'];?>"></input>
  					 <input type = "hidden" name = "bonus2[<?php echo $k?>]" id = "bonus2[<?php echo $k?>]" value = "0"></input>
  					 <input type = "hidden" name = "bonus3[<?php echo $k?>]" id = "bonus3[<?php echo $k?>]" value = "0"></input>
				<?php }else{?>
					 $<input type = "text" name = "final_bonus[<?php echo $k?>]" id = "final_bonus[<?php echo $k?>]" value = "<?php echo $v['final_bonus'];?>"></input>
					 <input type = "hidden" name = "bonus1[<?php echo $k?>]" id = "bonus1[<?php echo $k?>]" value = "0"></input>
  					 <input type = "hidden" name = "bonus2[<?php echo $k?>]" id = "bonus2[<?php echo $k?>]" value = "0"></input>
  					 <input type = "hidden" name = "bonus3[<?php echo $k?>]" id = "bonus3[<?php echo $k?>]" value = "0"></input>
				<?php }?>
				<?php }else{?>
				<?php if($v['total_sale']>= $v['target3']){?>
  					 $<input type = "text" name = "final_bonus[<?php echo $k?>]" id = "final_bonus[<?php echo $k?>]" value = "<?php echo ($v['htarget1']+$v['htarget2']+$v['htarget3']);?>"></input>
  					 <input type = "hidden" name = "bonus1[<?php echo $k?>]" id = "bonus1[<?php echo $k?>]" value = "<?php echo $v['htarget1'];?>"></input>
  					 <input type = "hidden" name = "bonus2[<?php echo $k?>]" id = "bonus2[<?php echo $k?>]" value = "<?php echo $v['htarget2'];?>"></input>
  					 <input type = "hidden" name = "bonus3[<?php echo $k?>]" id = "bonus3[<?php echo $k?>]" value = "<?php echo $v['htarget3'];?>"></input>
  					 				  
				<?php }elseif($v['total_sale']>= $v['target2']){?>
					 $<input type = "text" name = "final_bonus[<?php echo $k?>]" id = "final_bonus[<?php echo $k?>]" value = "<?php echo ($v['htarget1']+$v['htarget2']);?>"></input>
					 <input type = "hidden" name = "bonus1[<?php echo $k?>]" id = "bonus1[<?php echo $k?>]" value = "<?php echo $v['htarget1'];?>"></input>
  					 <input type = "hidden" name = "bonus2[<?php echo $k?>]" id = "bonus2[<?php echo $k?>]" value = "<?php echo $v['htarget2'];?>"></input>
  					 <input type = "hidden" name = "bonus3[<?php echo $k?>]" id = "bonus3[<?php echo $k?>]" value = "0"></input> 
				<?php }elseif($v['total_sale']>= $v['target1']){?> 
					 $<input type = "text" name = "final_bonus[<?php echo $k?>]" id = "final_bonus[<?php echo $k?>]" value = "<?php echo $v['htarget1'];?>"></input>  	   
					 <input type = "hidden" name = "bonus1[<?php echo $k?>]" id = "bonus1[<?php echo $k?>]" value = "<?php echo $v['htarget1'];?>"></input>
  					 <input type = "hidden" name = "bonus2[<?php echo $k?>]" id = "bonus2[<?php echo $k?>]" value = "0"></input>
  					 <input type = "hidden" name = "bonus3[<?php echo $k?>]" id = "bonus3[<?php echo $k?>]" value = "0"></input>
				<?php }else{?>
					 $<input type = "text" name = "final_bonus[<?php echo $k?>]" id = "final_bonus[<?php echo $k?>]" value = "0"></input>
					 <input type = "hidden" name = "bonus1[<?php echo $k?>]" id = "bonus1[<?php echo $k?>]" value = "0"></input>
  					 <input type = "hidden" name = "bonus2[<?php echo $k?>]" id = "bonus2[<?php echo $k?>]" value = "0"></input>
  					 <input type = "hidden" name = "bonus3[<?php echo $k?>]" id = "bonus3[<?php echo $k?>]" value = "0"></input>
				<?php }?>
				<?php }?>
			</td>
  		</tr>  
  <?php }?>
</table>

<div id = "table2">
<table>
	<tr>
		<th scope="col">Shop</th>
  	  	<th scope="col">Sales</th>
    	<th scope="col">Target1</th>
   	 	<th scope="col">Target2</th>
    	<th scope="col">Target3</th>
    	<th scope="col">Hit Target</th>
	</tr>
	<?php foreach($this->shopList as $k2 => $v2){
		if($k2 == 'BSIC' || $k2 == 'BSPC' || $k2 == 'BSXP' || $k2 == 'CLPC' || $k2 == 'CBPC' || $k2 == 'CBIC' || $k2 == 'EPIC' || $k2 == 'PMPC' || $k2 == 'PMIC' || $k2 == 'WBPC' || $k2 == 'WBIC' || $k2 == 'WGPC' || $k2 == 'WGIC'){?>
	<tr>
		<td><?php echo $k2?></td>
		<td><?php echo $v2['total']?></td>
		<td><?php echo $v2['target1']?></td>
		<td><?php echo $v2['target2']?></td>
		<td><?php echo $v2['target3']?></td>
		<td><?php if($v2['total']>= $v2['target3']){
  						echo "<span style=\"background-color:#3CF\">T3</span>";?> 					  
				<?php  }elseif($v2['total']>= $v2['target2']){
					   	echo "<span style=\"background-color:#0F0\">T2</span>";?>
				<?php  }elseif($v2['total']>= $v2['target1']){
					   	echo "<span style=\"background-color:#C90\">T1</span>";?>
				<?php  }else{
					   	echo "None";?>
				<?php  }?></td>
	</tr>
		<?php }?>
	<?php }?>
</table>
</div>
<br/>
<div id = "teamWizard" <?php if(!$this->nextCheck){?>style = "visibility:hidden;<?php }?>">
<input type = "submit" name = "next" id = "next" value = "Confirm&Next" style = "margin-left:750px;" onclick= "transfer('<?php echo $this->dateStart;?>','<?php echo $this->dateEnd;?>')"></input>
</div>
</form>
</body>
</html>